package stackandqueue.queue.test;

import stackandqueue.queue.circularqueue.CircularQueue;
import stackandqueue.queue.inter.Queue;
import stackandqueue.queue.linkedqueue.LinkedQueue;

public class QueueMain {
    public static void main(String[] args) {
        Queue<Character> queue = new LinkedQueue<>();
        initQueue(queue);
//        queue.clearQueue();
        queueTest(queue);
    }

    public static void initQueue(Queue queue) {
        System.out.println("将a,b,c,d,e,f入队：");
        for (int i = 0; i < 6; i++) {
            queue.enQueue((char) ('a' + i));
        }
    }

    public static void queueTest(Queue queue) {
        System.out.println("队列长度：" + queue.queueLength());
        System.out.println("输出队头元素：" + queue.getHead());
        System.out.println("队头元素出队：" + queue.deQueue());
        System.out.println("队列长度：" + queue.queueLength());
        System.out.println("输出队头元素：" + queue.getHead());
        System.out.println("y,z入队：");
        queue.enQueue('y');
        queue.enQueue('z');
        System.out.println("队列长度：" + queue.queueLength());
        System.out.println("输出队头元素：" + queue.getHead());
        System.out.println("元素依次出队：");
        while (!queue.queueEmpty()) {
            System.out.print(queue.deQueue() + " ");
        }
        System.out.println();
        System.out.println("队列长度：" + queue.queueLength());
        System.out.println("输出队头元素：" + queue.getHead());
    }
}
